package com.lyf.service.impl;

import com.lyf.entity.ResponseResult;
import com.lyf.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * @AUTHOR LYF
 * @DATE 2022/5/24
 * @VERSION 1.0
 * @DESC
 */
@Service
public class PayServiceImpl implements PayService {
    @Autowired
    RestTemplate restTemplate;
    @Override
    public void pay() {
        //restTemplate.getForObject()
        String reqUrl="http://localhost:8081/order/test";//直接路径方式
        ResponseEntity entity = restTemplate.getForEntity(reqUrl, ResponseResult.class);
        System.out.println(entity.getBody()+"::"+entity+"::"+entity.getStatusCode());
    }
}
